%{
	#include <stdio.h>
	#include <stdlib.h>
	#define YYDEBUG 1
%}

%union {
    int          int_value;
    double       double_value;
}
%token  minus plus V CR
%type <int_value> V exp number go list
%%
list:
    go
    | list go
    ;
go:
     exp CR
    {
        printf("%d\n",$1);
    };
exp:
    number
    | exp minus number
    {
        $$=$1-$3;
    }
    | exp plus number
    {
        $$=$1+$3;
    };

number:
    V
    ;
%%
int
yyerror(char const *str)
{
    extern char *yytext;
    fprintf(stderr, "parser error near %s\n", yytext);
    return 0;
}

int main(void)
{
    extern int yyparse(void);
    

    if (yyparse()) {
        fprintf(stderr, "Error ! Error ! Error !\n");
        exit(1);
    }
}